﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace HotelProject
{
    public partial class CurrentBookings : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void addRoomButton_Click(object sender, EventArgs e)
        {
            if (roomNumberTextBox.Text != "" || hotelIDTextBox.Text != "" || viewTextBox.Text != "" || floorNumberTextBox.Text != "" ||
                bedSizeTextBox.Text != "" || priceTextBox.Text != "")
            {
                MySQLDatabaseConnector database = new MySQLDatabaseConnector();
                hotelRoom newRoom = new hotelRoom();
                newRoom.roomNumber = Convert.ToInt32(roomNumberTextBox.Text);
                newRoom.hotelID = Convert.ToInt32(hotelIDTextBox.Text);
                newRoom.view = viewTextBox.Text;
                newRoom.floorNumber = Convert.ToInt32(floorNumberTextBox.Text);
                newRoom.bedSize = bedSizeTextBox.Text;
                newRoom.price = Convert.ToDecimal(priceTextBox.Text);
                database.addHotelRoom(newRoom);
                database.saveChanges();
                GridView1.DataBind();
            }
            
        }
    }
}